Skip to content

Add --cxml flag: write the LLM view straight to a file or stdout#27

Open
Atelier-Nocte wants to merge 1 commit into
karpathy:masterfrom
Atelier-Nocte:add-cxml-flag
Open

Add --cxml flag: write the LLM view straight to a file or stdout#27
Atelier-Nocte wants to merge 1 commit into
karpathy:masterfrom
Atelier-Nocte:add-cxml-flag

Conversation

@Atelier-Nocte

Copy link
Copy Markdown

The LLM view is the half of rendergit I use most, but the CXML text it builds (generate_cxml_text) is only reachable by opening the HTML page and copying the textarea. This adds an optional --cxml flag that emits that same text directly, so it can be scripted:

# write CXML to a file
rendergit https://github.com/karpathy/nanogpt --cxml nanogpt.txt

# or stream to stdout ('-' or bare --cxml) and pipe straight into whatever
rendergit https://github.com/karpathy/nanogpt --cxml - | llm "what does this repo do?"

Same UX ask as #10 (--copy --llm), minus the clipboard dependency.

Details:

  • ~20 lines in rendergit.py, no new dependencies. Without the flag, behavior is completely unchanged.
  • In --cxml mode no HTML is built or opened at all. Nice side effect: since READMEs render unsanitized into the auto-opened file:// page, this is also the safer mode for flattening untrusted repos.
  • Progress messages already go to stderr, so stdout carries pure CXML — pipes stay clean.
  • stdout mode reconfigures sys.stdout to UTF-8 with errors="replace" — Windows consoles default to cp1252 and would otherwise raise UnicodeEncodeError on the first emoji in someone's README.
  • Temp clone cleanup still runs through the existing finally.

🤖 Generated with Claude Code

The CXML payload already exists (generate_cxml_text) but was only
reachable by opening the HTML page and copying the textarea. --cxml
emits it directly for scripting/pipelines; default HTML behavior is
unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant